package com.biwin.module.authority.domain.entity;

import com.biwin.module.orm.api.entity.BwBasicEntity;

import javax.persistence.*;

/**
 * TODO
 *
 * @author biwin
 * @since 0.0.1
 */
@Entity
@Table(name = "menu")
@org.hibernate.annotations.Table(appliesTo = "menu", comment = "菜单表")
public class Menu extends BwBasicEntity {

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "parent_id", columnDefinition = " BIGINT(20) COMMENT '父级编号' ", foreignKey = @ForeignKey(value
            = ConstraintMode.NO_CONSTRAINT))
    private Menu parent;

    @Column(name = "name", columnDefinition = "VARCHAR(60) NOT NULL COMMENT '菜单名称' ")
    private String name;

    @Column(name = "url", columnDefinition = "VARCHAR(100) COMMENT '菜单路径' ")
    private String url;

    @Column(name = "menu_id_path", columnDefinition = "VARCHAR(1024) NOT NULL COMMENT '菜单id路径' ")
    private String menuIdPath;

    @Column(name = "menu_name_path", columnDefinition = "VARCHAR(1024) NOT NULL COMMENT '菜单名称路径' ")
    private String menuNamePath;

    @Column(name = "icon", columnDefinition = "VARCHAR(200) COMMENT '菜单图标' ")
    private String icon;

    @Column(name = "icon_skin", columnDefinition = "VARCHAR(200) COMMENT '图标皮肤' ")
    private String iconSkin;

    @Column(name = "enabled", columnDefinition = "BIT(1) NOT NULL DEFAULT B'1' COMMENT '菜单是否启用' ")
    private Boolean enabled;

    @Column(name = "quick_code", columnDefinition = "VARCHAR(20) COMMENT '菜单访问快捷键' ")
    private String quickCode;

    @Column(name = "sort", columnDefinition = "INT NOT NULL DEFAULT 0 COMMENT '排序号(数值越大排名越高)' ")
    private Integer sort = 0;

    @Column(name = "menu_level", columnDefinition = "INT NOT NULL DEFAULT 1 COMMENT '菜单层级(1是顶级)'")
    private Integer menuLevel = 1;

    @Column(name = "leaf", columnDefinition = "bit(1) NOT NULL DEFAULT B'1' COMMENT '是否是叶子节点(无下级节点)' ")
    private Boolean leaf = true;

    @Column(name = "menu_type", columnDefinition = "TINYINT(1) NOT NULL DEFAULT 0 COMMENT '菜单类型(0-系统,1-业务,2-工作台," +
            "3-第三方)' ")
    private Integer menuType;

    @Column(name = "access_type", columnDefinition = "TINYINT(1) NOT NULL DEFAULT 0 COMMENT '访问策略(0-无需登录可访问,1-登录均可访问,2-授权可访问)'")
    private Integer accessType;

    @Column(name = "system_identifier", columnDefinition = "VARCHAR(20) COMMENT '第三方系统标识' ")
    private String systemIdentifier;

    public Menu getParent() {
        return parent;
    }

    public void setParent(Menu parent) {
        this.parent = parent;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getMenuIdPath() {
        return menuIdPath;
    }

    public void setMenuIdPath(String menuIdPath) {
        this.menuIdPath = menuIdPath;
    }

    public String getMenuNamePath() {
        return menuNamePath;
    }

    public void setMenuNamePath(String menuNamePath) {
        this.menuNamePath = menuNamePath;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getIconSkin() {
        return iconSkin;
    }

    public void setIconSkin(String iconSkin) {
        this.iconSkin = iconSkin;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public String getQuickCode() {
        return quickCode;
    }

    public void setQuickCode(String quickCode) {
        this.quickCode = quickCode;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Integer getMenuLevel() {
        return menuLevel;
    }

    public void setMenuLevel(Integer menuLevel) {
        this.menuLevel = menuLevel;
    }

    public Boolean getLeaf() {
        return leaf;
    }

    public void setLeaf(Boolean leaf) {
        this.leaf = leaf;
    }

    public Integer getMenuType() {
        return menuType;
    }

    public void setMenuType(Integer menuType) {
        this.menuType = menuType;
    }

    public Integer getAccessType() {
        return accessType;
    }

    public void setAccessType(Integer accessType) {
        this.accessType = accessType;
    }

    public String getSystemIdentifier() {
        return systemIdentifier;
    }

    public void setSystemIdentifier(String systemIdentifier) {
        this.systemIdentifier = systemIdentifier;
    }
}
